﻿package ygg.encoding.swf.abc.object
{
	public class Multiname
	{
		private var _namespaces:Array;
		private var _name:String;
		
		public function Multiname()
		{
			super();
			namespaces = [];
		}
		
		public function get namespaces():Array { return _namespaces; }
		
		public function set namespaces(value:Array):void
		{
			_namespaces = value;
		}
		
		public function get name():String { return _name; }
		
		public function set name(value:String):void
		{
			_name = value;
		}
		
		// TODO: add resolving
		public function toString():String
		{
			var s:String = '';
			var len:uint = _namespaces.length;
			
			if (len > 1)
			{
				s += '(' + len + 'ns)';
				
			}
			else if (len > 0)
			{
				s += TypedNamespace(_namespaces[0]).ns;
			}
			
			if (s.length) s += '::';
			s += _name;
			
			return s;
		}
	}
}